
/**
 * Copyright (c) 2012 Gary Higham
 * Released under the MIT license
 * https://code.google.com/p/mock-as2/wiki/License
 *
 * Version: v0.1
 */
class mockAS2.Matcher {
	
	private var match : Function;
	
	public function Matcher() {
		
	}
	
	public function customMatch(matchFunction : Function) : Void {
		match = matchFunction;
	}

	public function isInstanceOf(type : Object) : Void {
		match = function(value : Object) : Boolean {return value instanceof type;};
	}
	
	public function isTypeOf(type : String) : Void {
		match = function(value : Object) : Boolean {return typeof(value) === type.toLowerCase();};
	}
	
	public function performMatch() : Boolean {
		return Boolean(match.apply(null, arguments));
	}
}
